﻿'********************************************************************************
'*
'*      モールド　フォーム
'*
'*      File Name : frmStartCompleteMold.vb
'*      Title     : モールド着工/完了履歴画面
'*      機能    　：モールド工程
'*
'********************************************************************************
'----------------------------------<<修正履歴>>----------------------------------
'ﾊﾞｰｼﾞｮﾝ   日付       作業者        ｺﾒﾝﾄ
'--------- ---------- ------------ -----------------------------------------------
' V1.0.0   2016/07/13 S.Yu         新規作成
' V2.0.0   2017/05/18 horaguchi    蘇州対応
' V3.0.0   2017/12/19 Y.Shimabukuro 北京対応
' V4.0.0   2017/12/19 miao　　　　 北京対応（廃棄フレーム枚数の必須チェックを削除）
' V4.0.0   2017/12/19 miao　　　　 北京対応臨時案（フレームID管理を判定しなく、計上する）
'********************************************************************************

Imports System.Text

Public Class frmStartCompleteMold
    '前工程 ラックケースNo
    Dim rackCaseNo As String = String.Empty
    '適用金型
    Private Const MOLD As String = "MJMD"
    Private Const RESIN As String = "MDRJ"

    'DB工程コード
    Private Const PROCCD_MOLD As String = "S41"

    ' 外部画面呼び出しTAG
    Private Const EXEC_PG_TAG_RESIN As String = "MD_RESIN"
    Private Const EXEC_PG_TAG_ATLAS As String = "MD_ATLAS"
    Dim inputRackNoArray As String() = {"", "", "", "", ""}

    '>>2018/2/13 大賀 サンプル数量対応
    Private AggregatePKG As String = String.Empty
    '>>2018/2/13 大賀 サンプル数量対応

    '>>2018/1/31 佐川 キャリア交換対応
    '実行モード
    '0:表示 1:着工 2:製造完成 3:計上完成
    Private execMode As String = VIEW
    '<<2018/1/31 佐川 キャリア交換対応
    ' add miaojf 2019/10/1 begin
    '規格値
    Private specValue As Integer
    '設備で設定したモールド数
    Private MouldNum As Integer
    'モールド組No.
    Private MouldGroupNo As String
    'SHOT数
    Private SHOTNum As Integer
    'IC数/枚：製造条件の項目名
    Private Const DP_CNT As String = "DP CNT"
    'IC数/枚
    Private intDP_CNT As Integer = 0
    ' add miaojf 2019/10/1 end
    Private NUMFLAG As Integer
    'Add Miaojf 2019/11/22 Begin
    Overrides Sub selectTab()

        tabBase.SelectedIndex = 2

        Me.UpdateStyles()
    End Sub
    'Public Overrides Sub SetFocus()

    '    'btnBarCode2.Enabled = True
    '    'btnBarCode2.PerformClick()
    '    'txt0002.Enabled = True
    '    'txt0002.Focus()
    'End Sub
    'Add Miaojf 2019/11/22 END

    '照合結果設定
    Public Overrides Sub SetPassScore()
        PASS_SCORE = 6
        ReDim m_iScore(PASS_SCORE - 1)
        m_iScore = {PASS_SCORE_WAIT_CHECK, PASS_SCORE_WAIT_CHECK, PASS_SCORE_WAIT_CHECK, PASS_SCORE_CHECKED, PASS_SCORE_CHECKED, PASS_SCORE_CHECKED}
    End Sub

    '照合結果クリア
    Public Overrides Sub InitualizeCollData()
        m_iScore = {PASS_SCORE_WAIT_CHECK, PASS_SCORE_WAIT_CHECK, PASS_SCORE_WAIT_CHECK, PASS_SCORE_CHECKED, PASS_SCORE_CHECKED, PASS_SCORE_CHECKED}
    End Sub
    Overrides Sub SetProcNo(ByRef procNo As String)
        procNo = PROC_CD_MOLDS
    End Sub
    Public Overrides Function AProcStartCompleteFLG() As Boolean
        Return True
    End Function

    Public Overrides Function AProcCD() As String
        Return PROC_CD_MOLDA
    End Function
    Public Overrides Function doAProcMoveIn() As Object
        Return True
    End Function
    Overrides Function doChkFrameID() As Boolean
        Return True
    End Function
    'イベント設定
    Public Overrides Sub SetHandler()
        '受入ラックNo
        AddHandler txt0302.KeyPress, AddressOf txtRackNoMD_KeyPress
        AddHandler txt0303.KeyPress, AddressOf txtRackNoMD_KeyPress
        AddHandler txt0304.KeyPress, AddressOf txtRackNoMD_KeyPress
        AddHandler txt0305.KeyPress, AddressOf txtRackNoMD_KeyPress
        AddHandler txt0306.KeyPress, AddressOf txtRackNoMD_KeyPress
        AddHandler txt0302.LostFocus, AddressOf txtRackNo_LostFocus
        AddHandler txt0303.LostFocus, AddressOf txtRackNo_LostFocus
        AddHandler txt0304.LostFocus, AddressOf txtRackNo_LostFocus
        AddHandler txt0305.LostFocus, AddressOf txtRackNo_LostFocus
        AddHandler txt0306.LostFocus, AddressOf txtRackNo_LostFocus
        AddHandler btnBarCode2.Click, AddressOf btnRackNo_Click '2018/2/22 佐川 ラックNo入力動作を統一

        '完了MSラックNo
        AddHandler txt0402.KeyPress, AddressOf afterRackNo_KeyPress
        AddHandler txt0403.KeyPress, AddressOf afterRackNo_KeyPress
        AddHandler txt0402.LostFocus, AddressOf txtRackNo_LostFocus
        AddHandler txt0403.LostFocus, AddressOf txtRackNo_LostFocus
        AddHandler btnBarCode3.Click, AddressOf btnAfterRackNo_Click '2018/2/22 佐川 ラックNo入力動作を統一

        '廃棄フレーム数
        AddHandler lbl0502.Click, AddressOf TenKeyClick

        'レジン・金型　再読込ボタン
        AddHandler btnRefresh.Click, AddressOf btnRefresh_Click

        '補充ボタン
        AddHandler btnResinAdd.Click, AddressOf btnResinAdd_Click

        ' >> 20180710 佐川 ラックNo途入力改善
        AddHandler txt0302.Click, AddressOf rackInputFocus
        AddHandler lbl0302.Click, AddressOf rackInputFocus
        AddHandler txt0303.Click, AddressOf rackInputFocus
        AddHandler lbl0303.Click, AddressOf rackInputFocus
        AddHandler txt0304.Click, AddressOf rackInputFocus
        AddHandler lbl0304.Click, AddressOf rackInputFocus
        AddHandler txt0305.Click, AddressOf rackInputFocus
        AddHandler lbl0305.Click, AddressOf rackInputFocus
        AddHandler txt0306.Click, AddressOf rackInputFocus
        AddHandler lbl0306.Click, AddressOf rackInputFocus
        AddHandler lbl0402.Click, AddressOf afterRackInputFocus
        AddHandler txt0402.Click, AddressOf afterRackInputFocus
        AddHandler lbl0403.Click, AddressOf afterRackInputFocus
        AddHandler txt0403.Click, AddressOf afterRackInputFocus
        ' << 20180710 佐川 ラックNo途入力改善

        '設備の治具情報を取得
        'getMachinInf()
        'MouldNum = MachineNameList.Count

    End Sub

    ' 製造完成時のチェック(必要な画面のみ)
    Protected Overrides Function ManufCompCheck() As Boolean
        Debug.WriteLine(System.Reflection.MethodBase.GetCurrentMethod.Name + " in")
        Return True
    End Function
    'DEL 苗 2018/1/5 臨時案（フレームID管理を判定しなく、計上する）BEGIN
    '' 計上完成時にATLAS画面を呼び出すかチェック(必要な画面のみ)
    'Protected Overrides Function isCompleteCallAtlas() As Boolean
    '    Debug.WriteLine(System.Reflection.MethodBase.GetCurrentMethod.Name + " in")
    '    ' 呼び出しが必要
    '    Return True
    'End Function

    '' 計上完成時にATLAS画面を呼び出す処理
    'Protected Overrides Function CallAtlasExec() As Boolean
    '    Debug.WriteLine(System.Reflection.MethodBase.GetCurrentMethod.Name + " in")
    '    Dim ret = True
    '    '外部EXEを呼び出す
    '    Dim strRetStatus As String = Execute_Command(lblProcessCD.Text, EXEC_PG_TAG_ATLAS)
    '    If strRetStatus = "0" Then
    '        ret = True
    '    Else
    '        MsgBox(getMsgStr("MSG10009", strRetStatus))
    '        ret = False
    '    End If
    '    '戻り値による処理は未定のため、現在は未実装
    '    Return True
    'End Function
    'DEL 苗 2018/1/5 臨時案（フレームID管理を判定しなく、計上する）END

    'Lot Noでデータベースからデータを取得する
    Public Overrides Sub GetDataByIcTag()
        Dim objDieClean As New clsDieClean
        m_RackWidthCheck = 1 'ADD 苗 2018/1/27 ラック桁数チェック
        '初期化
        InputDataClear()

        'ICタグのデータで画面を設定する
        SetFromTag()
        If m_MoveInCheck = False Then Exit Sub

        setGridViewLot()

        If String.IsNullOrEmpty(IcTag.szUID) Then
            IcTag = LastTag
        End If

        '条件テーブル取得
        setJyokenData()

        ResinTimer.Enabled = False
        '製造条件の設定
        Dim limitCode As String = String.Empty

        For Each dr In dtJyokenData.Rows
            If dr("KOMOKUNAME").Equals(lbl0100.Tag) Then
                lbl0102.Text = DBNullTOblank(dr("KOMOKUDATA"))
            ElseIf dr("KOMOKUNAME").Equals(lbl0200.Tag) Then
                lbl0202.Text = DBNullTOblank(dr("KOMOKUDATA"))
                '>>2018/2/13 大賀 サンプル数量対応
            ElseIf dr("KOMOKUNAME").Equals(AGGREGATE_PKG) Then
                AggregatePKG = DBNullTOblank(dr("KOMOKUDATA"))
                '<<2018/2/13 大賀 サンプル数量対応
            End If
        Next

        '適用金型チェック処理
        If Not checkMachineInf() Then
            Exit Sub
        End If

        '>>2018/1/31 佐川 キャリア交換対応
        '>>2018/2/07 佐川 RSB確認結果一覧No32
        htRackNo = New Hashtable
        Dim addCount As Integer = 0
        htRackNo.Add(addCount, IcTag.container1)
        addCount += 1
        If Not IcTag.container2.Equals("") Then
            htRackNo.Add(addCount, IcTag.container2)
            addCount += 1
        End If
        If Not IcTag.container3.Equals("") Then
            htRackNo.Add(addCount, IcTag.container3)
            addCount += 1
        End If
        If Not IcTag.container4.Equals("") Then
            htRackNo.Add(addCount, IcTag.container4)
            addCount += 1
        End If
        If Not IcTag.container5.Equals("") Then
            htRackNo.Add(addCount, IcTag.container5)
            addCount += 1
        End If
        '<<2018/2/07 佐川 RSB確認結果一覧No32
        '<<2018/1/31 佐川 キャリア交換対応

        '>>2018/2/19 大賀 No75 空チップ数量のl_tag_lotdata化
        ''DB工程情報取得
        ''工程コードからテーブル名を取得
        'Dim drEmptyChip As New DataTable
        'Dim dtTable As DataTable = m_cEquipMat.GetTitle(PROCCD_MOLD)
        'If dtTable.Rows.Count > 0 Then
        '    If Not String.IsNullOrEmpty(dtTable.Rows(0)("PROC_TABLE")) Then
        '        drEmptyChip = m_cEquipMat.GetDetailDataByProcCd(IcTag.szLotNo, TOTAL, dtTable.Rows(0)("PROC_TABLE"), PROCCD_MOLD)

        '        '空チップ数を表示
        '        If drEmptyChip.Rows.Count > 0 Then
        '            For Each dr In drEmptyChip.Rows
        '                If dr("MNF_CND_TAG").Equals(lbl0600.Tag) And Not String.IsNullOrEmpty(dr("ACTUAL_MODEL")) Then
        '                    lbl0602.Text = dr("ACTUAL_MODEL")
        '                End If
        '            Next
        '        End If
        '    End If
        'End If
        ' 空チップ数量をl_tag_lotdataから取得
        lbl0602.Text = IcTag.emptyChipNum.ToString()
        '<<2018/2/19 大賀 No75 空チップ数量のl_tag_lotdata化

        '工程明細テーブル取得
        setDetailData()

        '明細データの設定
        For Each dr In dtDetailData.Rows
            If dr("MNF_CND_TAG").Equals(lbl0100.Tag) Then
                'レジン型式
                txt0103.Text = DBNullTOblank(dr("ACTUAL_MODEL"))
                txt0104.Text = DBNullTOblank(dr("MATERIAL_LOT"))
                lbl0106.Text = DBNullTOblank(dr("LIMIT_TIME"))
            ElseIf dr("MNF_CND_TAG").Equals(lbl0200.Tag) Then
                '金型
                txt0203.Text = DBNullTOblank(dr("ACTUAL_MODEL"))
            ElseIf dr("MNF_CND_TAG").Equals(lbl0300.Tag) Then
                '受入ラックNo
                If dr("SEQ") = 1 Then
                    txt0302.Text = DBNullTOblank(dr("ACTUAL_MODEL")) 'UPD MIAO 2018/11/1
                ElseIf dr("SEQ") = 2 Then
                    txt0303.Text = DBNullTOblank(dr("ACTUAL_MODEL")) 'UPD MIAO 2018/11/1
                ElseIf dr("SEQ") = 3 Then
                    txt0304.Text = DBNullTOblank(dr("ACTUAL_MODEL")) 'UPD MIAO 2018/11/1
                ElseIf dr("SEQ") = 4 Then
                    txt0305.Text = DBNullTOblank(dr("ACTUAL_MODEL")) 'UPD MIAO 2018/11/1
                ElseIf dr("SEQ") = 5 Then
                    txt0306.Text = DBNullTOblank(dr("ACTUAL_MODEL")) 'UPD MIAO 2018/11/1
                End If
            ElseIf dr("MNF_CND_TAG").Equals(lbl0400.Tag) Then
                '完了MSラックNo
                If dr("SEQ") = 1 Then
                    txt0402.Text = DBNullTOblank(dr("ACTUAL_MODEL")) 'UPD MIAO 2018/11/1
                ElseIf dr("SEQ") = 2 Then
                    txt0403.Text = DBNullTOblank(dr("ACTUAL_MODEL")) 'UPD MIAO 2018/11/1
                End If
                'DEL 苗 2018/1/24 BEGIN
                'ElseIf dr("MNF_CND_TAG").Equals(lbl0500.Tag) Then
                '    '廃棄フレーム数
                '    lbl0502.Text = dr("ACTUAL_MODEL")
                'DEL 苗 2018/1/24 END
            End If
        Next

        '>>2018/2/13 大賀 サンプル数量対応
        If IcTag.Status = TagProcessStatus.Ready Then
            'TODO:DEL 着工前－＞着工後
            lblSampleText.Text = m_cSamplingDef.getSamplingMessage(IcTag.szProcsCD, AggregatePKG, g_EQUIP_NO, IcTag.iInput.ToString())
        Else
            Dim getData = dtDetailData.AsEnumerable().FirstOrDefault(Function(x) lblSampleTitle.Tag.Equals(x("MNF_CND_TAG")))
            If getData IsNot Nothing Then
                lblSampleText.Text = DBNullTOblank(getData("ACTUAL_MODEL")) 'UPD MIAO 2018/11/1
            End If
        End If
        '<<2018/2/13 大賀 サンプル数量対応

        '工程ヘッダーテーブル取得
        getHeadData()

        'ヘッダーの設定
        With m_dtMat
            If .Rows.Count > 0 Then
                '着完情報
                DisplayDate()
            Else
                If m_dtMat.Columns.Count > 0 Then
                    .Rows.Add()
                Else
                    .Columns.Add("BEGIN_TIME")
                    .Rows.Add()
                End If
            End If
        End With
        'ADD 苗 2018/1/5 BEGIN
        lblLostframe = lbl0502
        strLostFrame = lbl0500.Text
        'ADD 苗 2018/1/5 END

        'ADD 苗 2018/1/24 BEGIN
        'L_TAG_LOTDATAからIC廃棄のフレーム枚数を画面に設定
        lbl0502.Text = IcTag.iDisposalFrmNum
        'ADD 苗 2018/1/24 END

        'ADD miao 2018/8/15 Begin
        'PKG チェック
        chkPKG()
        'ADD miao 2018/8/15 END
        chkResin() 'ADD Miao 2018/8/24

        'add miaojf 2019/10/1 begin
        '設備の治具情報の再取得
        'getMachinInf()
        'MouldNum = MachineNameList.Count
        MouldNum = objDieClean.getGroupSum(lblEquipID.Text)
        intDP_CNT = CInt(m_cData.getDTCount(IcTag.szLotNo))
        If intDP_CNT <> 0 And MouldNum <> 0 Then
            'モールドNo.=设备装置设定的模具数/2
            'MouldGroupNo = lblEquipID.Text & "-" & CStr(MouldNum / 2)

            'SHOT数=投入数/每枚IC数/模组数
            SHOTNum = Math.Ceiling(IcTag.iInput / intDP_CNT / 2 / MouldNum)
        End If
        If IcTag.Status <> TagProcessStatus.Ready Then
            ResinTimer.Enabled = True
        End If
        RandCheckFLAG = True

        pkgFLG = 1
    End Sub

    Public Overrides Sub JiSuccess()
        MyBase.JiSuccess()
        'lblPcbCnt.Text = String.Empty 'ADD 苗 2018/1/13 
        ResinTimer.Enabled = True

    End Sub

    'ADD Miao 2018/8/24 BEGIN
    'レンジ切替後のチェックを実施する
    Private Sub chkResin()
        Dim Param As String
        Param = m_cEquipMat.getResinCheckParam(lblEquipID.Text, lbl0102.Text)
        If Param <> "0" Then
            MsgBox(getMsgStr("MSG10050", Param))
        End If
        m_cEquipMat.SetLastResin(lblEquipID.Text, lbl0102.Text) 'UPD MIAO 2018/8/27 
    End Sub
    'ADD Miao 2018/8/24 END
    'ADD miao 2018/8/15 Begin
    Private Sub chkPKG()

        Dim PKG As String = g_DBSFCommon.GetFactoryInfo_Str2("9994", "")
        If PKG = "" Then Exit Sub
        Dim subPKG As String
        subPKG = lblShape.Text.ToString.Split("-")(0)

        If PKG.Contains(subPKG) Then

            Dim strGetPKG As String
            strGetPKG = m_cEquipMat.getPKG(lblEquipID.Text, subPKG)

            If strGetPKG = "0" Then
                Exit Sub
            End If

            If subPKG = strGetPKG Then
                Exit Sub
            End If

            '不正
            MsgBox(getMsgStr("MSG10049"))

        End If
        m_cEquipMat.setPKG(lblEquipID.Text, subPKG)
    End Sub
    'ADD miao 2018/8/15 END
    '初期化、背景色の設定
    Public Sub InputDataClear()

        '>>2018/1/31 佐川 キャリア交換対応
        execMode = VIEW
        '<<2018/1/31 佐川 キャリア交換対応

        'ロットタブの初期化
        clearActualModel()

        'レジン
        lbl0102.Text = String.Empty
        lbl0103.Text = String.Empty
        txt0103.Text = String.Empty
        lbl0104.Text = String.Empty
        txt0104.Text = String.Empty
        lbl0106.Text = String.Empty
        lbl0103.BackColor = NORMAL_INIT_COLOR
        txt0103.BackColor = NORMAL_INIT_COLOR
        lbl0104.BackColor = NORMAL_INIT_COLOR
        txt0104.BackColor = NORMAL_INIT_COLOR
        lbl0106.BackColor = NORMAL_INIT_COLOR

        '金型
        lbl0202.Text = String.Empty
        lbl0203.Text = String.Empty
        txt0203.Text = String.Empty
        lbl0203.BackColor = NORMAL_INIT_COLOR
        txt0203.BackColor = NORMAL_INIT_COLOR

        '受入ラックNo
        txt0302.Text = String.Empty
        txt0303.Text = String.Empty
        txt0304.Text = String.Empty
        txt0305.Text = String.Empty
        txt0306.Text = String.Empty
        txt0302.BackColor = BARCODE_INIT_COLOR
        lbl0302.BackColor = BARCODE_INIT_COLOR
        txt0303.BackColor = BARCODE_INIT_COLOR
        lbl0303.BackColor = BARCODE_INIT_COLOR
        txt0304.BackColor = BARCODE_INIT_COLOR
        lbl0304.BackColor = BARCODE_INIT_COLOR
        txt0305.BackColor = BARCODE_INIT_COLOR
        lbl0305.BackColor = BARCODE_INIT_COLOR
        txt0306.BackColor = BARCODE_INIT_COLOR
        lbl0306.BackColor = BARCODE_INIT_COLOR

        '完了MSラックNo
        txt0402.Text = String.Empty
        txt0403.Text = String.Empty
        lbl0402.BackColor = NORMAL_INIT_COLOR
        txt0402.BackColor = NORMAL_INIT_COLOR
        lbl0403.BackColor = NORMAL_INIT_COLOR
        txt0403.BackColor = NORMAL_INIT_COLOR

        '廃棄フレーム数
        lbl0502.Text = "0"
        lbl0502.BackColor = NORMAL_INIT_COLOR

        '空チップ数
        lbl0602.Text = String.Empty
        lbl0602.BackColor = NORMAL_INIT_COLOR

        '開始作業者No
        txtOptNoStt.Text = String.Empty
        '終了作業者No
        txtOptNoEnd.Text = String.Empty

        '>>2018/2/15 大賀 サンプル数量対応 計上完成後のクリア漏れ
        lblSampleText.Text = String.Empty
        '<<2018/2/15 大賀 サンプル数量対応 計上完成後のクリア漏れ

    End Sub

    '画面データ保存（着工時）
    Public Overrides Function SaveEquipMat(ByRef szBeginTime As DateTime) As Boolean

        '>>2018/1/31 佐川 キャリア交換対応
        execMode = BEGIN
        '<<2018/1/31 佐川 キャリア交換対応

        If saveDetail(BEGIN) < 0 Then
            Return False
        Else
            Return True
        End If
    End Function

    '画面データ保存（製造完成）
    Public Overrides Function SaveCompleteInfo(Optional ByVal status As ProcessStatus = ProcessStatus.ManufComplete) As Integer

        '>>2018/1/31 佐川 キャリア交換対応
        execMode = COMPLETE
        '<<2018/1/31 佐川 キャリア交換対応

        dtDBUpd.Clear()
        Return saveDetail(COMPLETE)
    End Function

    '画面データ保存（計上完成）
    Public Overrides Function SaveTotalInfo() As Integer

        '>>2018/1/31 佐川 キャリア交換対応
        execMode = TOTAL
        '<<2018/1/31 佐川 キャリア交換対応

        'ADD miaojf 2019/10/1
        'MOLD清掃データ更新
        updDieCleanInfo()


        dtDBUpd.Clear()
        Return saveDetail(TOTAL)
    End Function

    'MOLD清掃データ更新
    Private Sub updDieCleanInfo()

        Dim objDieClean As New clsDieClean
        Dim dt As DataTable
        Dim PKG As String = lblShape.Text
        Dim LotNo As String = txtLotNo.Text

        'T_Alarm_A51_DieCleanの累計SHOT数を更新
        objDieClean.updDieClean(lblEquipID.Text, SHOTNum, NUMFLAG)

        dt = objDieClean.selSpecDt(lblEquipID.Text)
        If dt.Rows.Count > 0 Then
            For Each dr As DataRow In dt.Rows
                'T_A51_DieCleanRecordのデータ新規
                objDieClean.insertRecord(lblEquipID.Text, dr("MouldGroupNo"), PKG, LotNo, SHOTNum, dr("SUMSHOT"))
            Next

        End If


        'TODO:設備ロック：  具体语句后期陈力红提供
    End Sub
    '工程明細テーブル更新処理
    Private Function saveDetail(ByVal type As String) As Integer
        setLotData()
        Dim rowsCnt As Integer = dtDBUpd.Rows.Count
        Dim addIndex As Integer = 0

        'レジン
        dtDBUpd.Rows.Add()
        dtDBUpd.Rows(rowsCnt)("MNF_CND_TAG") = lbl0100.Tag
        dtDBUpd.Rows(rowsCnt)("MNF_CND_TAG_FLG") = CND_TAG_FLG_JYOKEN
        dtDBUpd.Rows(rowsCnt)("SEQ") = 1
        dtDBUpd.Rows(rowsCnt)("MNF_CONDITION") = lbl0102.Text
        dtDBUpd.Rows(rowsCnt)("ACTUAL_MODEL") = txt0103.Text
        dtDBUpd.Rows(rowsCnt)("MATERIAL_LOT") = txt0104.Text
        dtDBUpd.Rows(rowsCnt)("LIMIT_TIME") = lbl0106.Text
        addIndex += 1

        '金型
        dtDBUpd.Rows.Add()
        dtDBUpd.Rows(rowsCnt + addIndex)("MNF_CND_TAG") = lbl0200.Tag
        dtDBUpd.Rows(rowsCnt + addIndex)("MNF_CND_TAG_FLG") = CND_TAG_FLG_JYOKEN
        dtDBUpd.Rows(rowsCnt + addIndex)("SEQ") = 1
        dtDBUpd.Rows(rowsCnt + addIndex)("MNF_CONDITION") = lbl0202.Text
        dtDBUpd.Rows(rowsCnt + addIndex)("ACTUAL_MODEL") = txt0203.Text
        addIndex += 1

        '受入ラックNo1
        dtDBUpd.Rows.Add()
        dtDBUpd.Rows(rowsCnt + addIndex)("MNF_CND_TAG") = lbl0300.Tag
        dtDBUpd.Rows(rowsCnt + addIndex)("MNF_CND_TAG_FLG") = CND_TAG_FLG_ELSE
        dtDBUpd.Rows(rowsCnt + addIndex)("SEQ") = 1
        dtDBUpd.Rows(rowsCnt + addIndex)("ACTUAL_MODEL") = txt0302.Text
        addIndex += 1

        '受入ラックNo2
        dtDBUpd.Rows.Add()
        dtDBUpd.Rows(rowsCnt + addIndex)("MNF_CND_TAG") = lbl0300.Tag
        dtDBUpd.Rows(rowsCnt + addIndex)("MNF_CND_TAG_FLG") = CND_TAG_FLG_ELSE
        dtDBUpd.Rows(rowsCnt + addIndex)("SEQ") = 2
        dtDBUpd.Rows(rowsCnt + addIndex)("ACTUAL_MODEL") = txt0303.Text
        addIndex += 1

        '受入ラックNo3
        dtDBUpd.Rows.Add()
        dtDBUpd.Rows(rowsCnt + addIndex)("MNF_CND_TAG") = lbl0300.Tag
        dtDBUpd.Rows(rowsCnt + addIndex)("MNF_CND_TAG_FLG") = CND_TAG_FLG_ELSE
        dtDBUpd.Rows(rowsCnt + addIndex)("SEQ") = 3
        dtDBUpd.Rows(rowsCnt + addIndex)("ACTUAL_MODEL") = txt0304.Text
        addIndex += 1

        '受入ラックNo4
        dtDBUpd.Rows.Add()
        dtDBUpd.Rows(rowsCnt + addIndex)("MNF_CND_TAG") = lbl0300.Tag
        dtDBUpd.Rows(rowsCnt + addIndex)("MNF_CND_TAG_FLG") = CND_TAG_FLG_ELSE
        dtDBUpd.Rows(rowsCnt + addIndex)("SEQ") = 4
        dtDBUpd.Rows(rowsCnt + addIndex)("ACTUAL_MODEL") = txt0305.Text
        addIndex += 1

        '受入ラックNo5
        dtDBUpd.Rows.Add()
        dtDBUpd.Rows(rowsCnt + addIndex)("MNF_CND_TAG") = lbl0300.Tag
        dtDBUpd.Rows(rowsCnt + addIndex)("MNF_CND_TAG_FLG") = CND_TAG_FLG_ELSE
        dtDBUpd.Rows(rowsCnt + addIndex)("SEQ") = 5
        dtDBUpd.Rows(rowsCnt + addIndex)("ACTUAL_MODEL") = txt0306.Text
        addIndex += 1

        If type <> BEGIN Then
            '完了MSラックNo1
            dtDBUpd.Rows.Add()
            dtDBUpd.Rows(rowsCnt + addIndex)("MNF_CND_TAG") = lbl0400.Tag
            dtDBUpd.Rows(rowsCnt + addIndex)("MNF_CND_TAG_FLG") = CND_TAG_FLG_ELSE
            dtDBUpd.Rows(rowsCnt + addIndex)("SEQ") = 1
            dtDBUpd.Rows(rowsCnt + addIndex)("ACTUAL_MODEL") = txt0402.Text
            addIndex += 1

            '完了MSラックNo2 
            dtDBUpd.Rows.Add()
            dtDBUpd.Rows(rowsCnt + addIndex)("MNF_CND_TAG") = lbl0400.Tag
            dtDBUpd.Rows(rowsCnt + addIndex)("MNF_CND_TAG_FLG") = CND_TAG_FLG_ELSE
            dtDBUpd.Rows(rowsCnt + addIndex)("SEQ") = 2
            dtDBUpd.Rows(rowsCnt + addIndex)("ACTUAL_MODEL") = txt0403.Text
            addIndex += 1

            '1/30 苗 履歴に保存するようにコメントを解除する
            '廃棄フレーム数
            dtDBUpd.Rows.Add()
            dtDBUpd.Rows(rowsCnt + addIndex)("MNF_CND_TAG") = lbl0500.Tag
            dtDBUpd.Rows(rowsCnt + addIndex)("MNF_CND_TAG_FLG") = CND_TAG_FLG_ELSE
            dtDBUpd.Rows(rowsCnt + addIndex)("SEQ") = 1
            dtDBUpd.Rows(rowsCnt + addIndex)("ACTUAL_MODEL") = lbl0502.Text
            addIndex += 1

            '空チップ数
            dtDBUpd.Rows.Add()
            dtDBUpd.Rows(rowsCnt + addIndex)("MNF_CND_TAG") = lbl0600.Tag
            dtDBUpd.Rows(rowsCnt + addIndex)("MNF_CND_TAG_FLG") = CND_TAG_FLG_ELSE
            dtDBUpd.Rows(rowsCnt + addIndex)("SEQ") = 1
            dtDBUpd.Rows(rowsCnt + addIndex)("ACTUAL_MODEL") = lbl0602.Text
            addIndex += 1
        End If
        '廃棄フレーム数の格納
        m_disposalFrmNum = CInt(lbl0502.Text) 'ADD 苗 2018/1/24

        '>>2018/2/13 大賀 サンプル数量対応
        'サンプル数量
        dtDBUpd.Rows.Add()
        dtDBUpd.Rows(rowsCnt + addIndex)("MNF_CND_TAG") = lblSampleTitle.Tag
        dtDBUpd.Rows(rowsCnt + addIndex)("MNF_CND_TAG_FLG") = CND_TAG_FLG_ELSE
        dtDBUpd.Rows(rowsCnt + addIndex)("SEQ") = 1
        dtDBUpd.Rows(rowsCnt + addIndex)("ACTUAL_MODEL") = lblSampleText.Text
        addIndex += 1
        '<<2018/2/13 大賀 サンプル数量対応

        Return m_cEquipMat.SaveDetail(lotNo, IcTag.szProcsCD, type,
                                      m_szTable, dtDBUpd, m_dtHeader,
                                      m_cIdohyo.EquipInfo.szEquipNo, serverTime)
    End Function

    '計上完成時チェック処理
    Public Overrides Function EndCheck() As Boolean
        Dim CheckFlag As Boolean = True

        '>>2018/2/20 大賀 No79 計上完成時にBSiteチェック実施
        ''レジン_現物型式の不一致チェック
        'CheckFlag = checkMatch(lbl0102.Text, txt0103.Text, lbl0100.Text, txt0103.Name)
        'If Not CheckFlag Then
        '    checkColor(txt0103, CheckFlag, txt0103.Name)
        '    Return CheckFlag
        'End If

        ''金型_現物型式の不一致チェック
        'CheckFlag = checkMatch(lbl0202.Text, txt0203.Text, lbl0200.Text, txt0203.Name)
        'If Not CheckFlag Then
        '    checkColor(txt0203, CheckFlag, txt0203.Name)
        '    Return CheckFlag
        'End If
        If Not checkMachineInf() Then
            Return False
        End If
        '<<2018/2/20 大賀 No79 計上完成時にBSiteチェック実施

        '完了MSラックNo1の空白チェック
        CheckFlag = checkBlank(txt0402.Text, lbl0400.Text)
        If Not CheckFlag Then
            checkColor(txt0402, CheckFlag, lbl0402.Name)
            Return CheckFlag
        End If

        '完了MSラックNo1,2の重複チェック
        If txt0402.Text.Equals(txt0403.Text) Then
            CheckFlag = False
            MsgBox(getMsgStr("MSG00064", lbl0400.Text))
            checkColor(txt0402, CheckFlag, lbl0402.Name)
            Return CheckFlag
        End If
        'DEL 苗 2018/1/5 BEGIN
        '廃棄フレーム数の空白チェック
        'CheckFlag = checkBlank(lbl0502.Text, lbl0500.Text)
        'If Not CheckFlag Then
        '    checkColor(lbl0502, CheckFlag, lbl0502.Name)
        '    Return CheckFlag
        'End If
        'DEL 苗 2018/1/5 END

        IcTag.iDisposalFrmNum = lbl0502.Text 'ADD 苗 2018/1/24
        Return CheckFlag

    End Function

    'レジン・金型 B-Siteチェック
    Private Function checkMachineInf() As Boolean

        If btnStart.Text = getMsgStr("MSG00121") Then
            Return True
        End If
        'セル初期化
        txt0103.Text = String.Empty
        txt0104.Text = String.Empty
        lbl0106.Text = String.Empty
        txt0203.Text = String.Empty
        txt0103.BackColor = NORMAL_INIT_COLOR
        lbl0103.BackColor = NORMAL_INIT_COLOR
        txt0104.BackColor = NORMAL_INIT_COLOR
        lbl0104.BackColor = NORMAL_INIT_COLOR
        txt0203.BackColor = NORMAL_INIT_COLOR
        lbl0203.BackColor = NORMAL_INIT_COLOR
        lbl0106.BackColor = NORMAL_INIT_COLOR 'Add 苗 2018/2/9

        'B-Site ViewMachineService
        Dim clientProcCd = GetBsiteClientString()
        Dim outMachine = getViewLotService(clientProcCd)

        'レジン取得
        If String.IsNullOrEmpty(lbl0102.Text) Then
            m_iScore(CInt(txt0103.Tag.ToString) - 1) = PASS_SCORE_CHECKED
        Else
            Dim ResinMaterialList = getMachineMaterialListByCategory(outMachine, RESIN).Where(Function(x) x.Type IsNot Nothing And x.Lot IsNot Nothing And x.DueDate IsNot Nothing).ToList
            If ResinMaterialList.Count = 0 Then
                ' B-Siteから取得できない
                MsgBox(getMsgStr("MSG00101", lbl0100.Text))
                checkColor(txt0103, False, lbl0103.Name)
                checkColor(txt0104, False, lbl0104.Name)
                checkColor(lbl0106, False, lbl0106.Name)
                m_iScore(CInt(txt0103.Tag.ToString) - 1) = PASS_SCORE_WAIT_CHECK
                Return False
            End If
            Dim resinData = ResinMaterialList.FirstOrDefault(Function(x) x.Type = lbl0102.Text)
            If resinData Is Nothing Then
                ' 製造条件と一致しない
                MsgBox(getMsgStr("MSG10030", lbl0100.Text, makeViewMachineTypeString(ResinMaterialList)))
                checkColor(txt0103, False, lbl0103.Name)
                m_iScore(CInt(txt0103.Tag.ToString) - 1) = PASS_SCORE_WAIT_CHECK
                Return False
            Else
                txt0103.Text = resinData.Type.Trim
                txt0104.Text = resinData.Lot.Trim
                lbl0106.Text = resinData.DueDate 'ADD 苗 2018/2/9
                ''ADD 苗 2018/2/9 BEGIN
                'Dim dtNow As DateTime = m_cData.GetServerTime()
                'Dim dt As DateTime
                'If DateTime.TryParse(resinData.DueDate, dt) Then
                '    dt.AddMinutes(-20) 'ADD MIAO　20191227 UPD 材料期限-20分をオーバーしたらエラーメッセージを表示する

                '    If DateTime.Compare(dt, dtNow) < 0 OrElse DateTime.Compare(dt, dtNow) = 0 Then
                '        MsgBox(getMsgStr("MSG00049", lbl0100.Text))
                '        checkColor(lbl0106, False, lbl0106.Name)
                '        m_iScore(CInt(txt0103.Tag.ToString) - 1) = PASS_SCORE_WAIT_CHECK
                '        Return False
                '    Else
                '        '製造条件一致
                '        m_iScore(CInt(txt0103.Tag.ToString) - 1) = PASS_SCORE_CHECKED
                '    End If
                'Else
                '    MsgBox(getMsgStr("MSG00048", lbl0100.Text))
                '    checkColor(lbl0106, False, lbl0106.Name)
                '    m_iScore(CInt(txt0103.Tag.ToString) - 1) = PASS_SCORE_WAIT_CHECK
                '    Return False
                'End If
                ''ADD 苗 2018/2/9 END
                checkExpirationDate(lbl0106, 0)
            End If
        End If

        '金型取得
        If String.IsNullOrEmpty(lbl0202.Text) Then
            m_iScore(CInt(txt0203.Tag.ToString) - 1) = PASS_SCORE_CHECKED
        Else
            Dim MoldMaterialList = getSubMachineListByCategory(outMachine, MOLD).Where(Function(x) x.MachineTypeCode IsNot Nothing).ToList
            If MoldMaterialList.Count = 0 Then
                ' B-Siteから取得できない
                MsgBox(getMsgStr("MSG00101", lbl0200.Text))
                checkColor(txt0203, False, lbl0203.Name)
                m_iScore(CInt(txt0203.Tag.ToString) - 1) = PASS_SCORE_WAIT_CHECK
                Return False
            End If
            Dim moldData = MoldMaterialList.FirstOrDefault(Function(x) x.MachineTypeCode = lbl0202.Text)
            If moldData Is Nothing Then
                ' 製造条件と一致しない
                MsgBox(getMsgStr("MSG10030", lbl0200.Text, makeViewMachineTypeString(MoldMaterialList)))
                checkColor(txt0203, False, lbl0203.Name)
                m_iScore(CInt(txt0203.Tag.ToString) - 1) = PASS_SCORE_WAIT_CHECK
                Return False
            Else
                txt0203.Text = moldData.MachineTypeCode.Trim
                m_iScore(CInt(txt0203.Tag.ToString) - 1) = PASS_SCORE_CHECKED
            End If
        End If
        IcTag.szLotNo = txtLotNo.Text
        CheckCollScore()
        Return True
    End Function

    '再読込ボタン押下
    Protected Sub btnRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        checkMachineInf()

        ''設備の治具情報の再取得
        'getMachinInf()
        'MouldNum = MachineNameList.Count
        'If intDP_CNT <> 0 And MouldNum <> 0 Then

        '    'モールドNo.=设备装置设定的模具数/2
        '    MouldGroupNo = lblEquipID.Text & "-" & CStr(MouldNum / 2)

        '    'SHOT数=投入数/每枚IC数/模组数
        '    SHOTNum = IcTag.iInput / intDP_CNT / (MouldNum / 2)
        'End If
    End Sub

    '補充ボタン押下
    Protected Sub btnResinAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        '外部EXEを呼び出す
        Dim strRetStatus As String = Execute_Command(IIf(AProcCD() = "", lblProcessCD.Text, AProcCD), EXEC_PG_TAG_RESIN, IcTag.szLotNo, g_EQUIP_NO, "", UserNo) 'UPD 苗 2018/1/24,1/26ロットNO.装置No.を設定
        '戻り値による処理は未定のため、現在は未実装
        If strRetStatus = "0" Then
            'B-Siteチェック
            checkMachineInf()
            'Dim rd As New receiveCommandData
            'rd.matType = EXEC_PG_TAG_RESIN
            'setChangeForPQC(rd)
        Else
            MsgBox(getMsgStr("MSG10009", strRetStatus))
        End If
    End Sub
    Overrides Sub jyokenRefresh()
        checkMachineInf()
    End Sub
    Overrides Function chkMatChanged() As Boolean
        Dim pqc As New clsPQCCheck
        Dim katamei As String = ""
        Dim matlot As String = ""
        Dim rtn As Boolean = False
        pqc.selectPQC(lblEquipID.Text, katamei, matlot)

        If katamei = "" And txt0103.Text <> "" Then
            pqc.insertPQC(lblEquipID.Text, txt0103.Text, matlot)
            rtn = False
        End If
        If katamei <> "" Then
            If katamei = txt0103.Text Then
                rtn = False
            Else
                If txt0103.Text <> "" Then
                    pqc.updatePQC(lblEquipID.Text, txt0103.Text, matlot)
                    setChangeForPQC(EXEC_PG_TAG_RESIN)
                End If

                rtn = True
            End If
        End If
        Return rtn
    End Function
    '受入MSラックNo入力処理
    Protected Sub txtRackNoMD_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)

        '頭に付いている'%'を消す
        Static Dim fIsPercentInput As Boolean = False
        If e.KeyChar = CChar("%") OrElse e.KeyChar = CChar("％") Then
            fIsPercentInput = True
            e.Handled = True
            Exit Sub
        End If
        If fIsPercentInput Then
            fIsPercentInput = False
            e.Handled = True
            Exit Sub
        End If

        If e.KeyChar = vbCr Then
            Dim txtData As TextBox = CType(sender, TextBox)
            txtData.Text = txtData.Text.ToUpper 'Add 苗 2018/4/10
            Dim lblSys As Label = txtData.Parent.Controls.Find(String.Format("lbl{0}", txtData.Name.ToString.Substring(3, 4)), False)(0)
            Dim lblMsg As Label = txtData.Parent.Controls.Find(String.Format("lbl{0}00", txtData.Tag.ToString), False)(0)
            Dim rackChkFlg As Boolean = False

            'Add 苗 2019/11/24 Begin
            If AutoManualMode = 0 And AUTO_MANUAL_BTN = TYPE_AUTO Then
                Dim tmpLotNo As String
                tmpLotNo = getLotNoByRack(txtData.Text)
                If txtLotNo.Text = "" Or (tmpLotNo <> "" And txtLotNo.Text <> tmpLotNo) Then
                    txtLotNo.Text = tmpLotNo
                    If txtLotNo.Text.Trim() <> "" Then
                        txtLotNo_KeyPress(txtLotNo, New KeyPressEventArgs(vbCr))
                        'If AutoManualMode = 0 Then
                        setBeforeRackNo()
                        'End If
                        Exit Sub
                    End If
                End If
            End If
            'Add 苗 2019/11/24 End

            If txtData.Name = String.Format("txt{0}02", txtData.Tag.ToString) Then
                ' LostFocusがラックNo1の場合，空白チェックを行う
                If String.IsNullOrEmpty(txtData.Text) Then
                    txtData.BackColor = ERROR_INIT_COLOR
                    lblSys.BackColor = ERROR_INIT_COLOR
                    txtData.Enabled = True 'UPD 苗 2018/2/6
                    MsgBox(getMsgStr("MSG00020", (lblMsg.Text).Replace(vbCrLf, "")))
                    txtData.Enabled = True '2018/2/22 佐川 ラックNo入力動作を統一
                    txtData.Focus() 'ADD 苗 2018/2/6
                    txtData.SelectAll() 'ADD 苗 2018/2/6
                    Exit Sub
                End If
            End If

            ' 着工時のみ前工程のラックNoと比較する
            If IcTag.Status = TagProcessStatus.Ready Then

                'ラックNoが削除ラックNoの場合、重複チェックを行わない。
                If DELETE_RACK_NO.Equals(txtData.Text) Or txtData.Text.Equals("") Then
                    rackChkFlg = True
                Else
                    inputRackNoArray(CInt(txtData.Name.ToString.Substring(5, 2)) - 2) = txtData.Text
                    ' ラックNoを前工程と比較
                    For i = 0 To htRackNo.Count - 1 '2018/2/22 佐川 ラックNo入力動作を統一
                        ' 前工程のラックNoと一致する場合
                        If htRackNo(i).Equals(txtData.Text) Then
                            ' 重複チェックを行う
                            rackChkFlg = chkRackNo(txtData, lblSys)

                            If Not rackChkFlg Then
                                txtData.Enabled = True 'ADD 苗 2018/2/6
                                txtData.Focus() 'ADD 苗 2018/2/6
                                txtData.SelectAll() 'ADD 苗 2018/2/6
                                ' 重複していたら抜ける
                                Exit Sub
                            End If

                            rackChkFlg = True
                            Exit For
                        End If
                    Next

                End If

                ' 前工程のどのラックNoとも一致しない場合
                If Not rackChkFlg Then
                    MsgBox(getMsgStr("MSG00052", lblMsg.Text))
                    txtData.BackColor = ERROR_INIT_COLOR
                    lblSys.BackColor = ERROR_INIT_COLOR
                    txtData.Enabled = True 'UPD 苗 2018/2/6
                    txtData.Focus() 'ADD 苗 2018/2/6
                    txtData.SelectAll() 'ADD 苗 2018/2/6
                    m_iScore(CInt(txtData.Tag) - 1) = PASS_SCORE_WAIT_CHECK
                    Exit Sub
                End If
            Else
                ' 空白じゃない場合，重複チェックを行う
                If Not String.IsNullOrEmpty(txtData.Text) Then
                    If Not chkRackNo(txtData, lblSys) Then
                        txtData.Enabled = True 'UPD 苗 2018/2/6
                        txtData.Focus() 'ADD 苗 2018/2/6
                        txtData.SelectAll() 'ADD 苗 2018/2/6
                        Exit Sub
                    End If
                End If
            End If

            '>>20180313 大賀 搬送容器桁数チェックを共通化
            ' ラックNoの桁数チェック
            If Not isCheckCaseLength(txtData, RACK_CASE_NO_LENGTH, lblSys) Then
                m_iScore(CInt(txtData.Tag) - 1) = PASS_SCORE_WAIT_CHECK
                Exit Sub
            End If
            '<<20180313 大賀 搬送容器桁数チェックを共通化


            ' 着工時のみ前工程のラックNoと比較する
            If IcTag.Status = TagProcessStatus.Ready Then
                ' ラック数が前工程と一致した場合 かつ ラックNoが全削除でない場合
                If htRackNo.Count = CInt(txtData.Name.ToString.Substring(5, 2)) - 1 AndAlso chkAllDelRackNo(inputRackNoArray) Then
                    txtData.BackColor = ENTERED_INIT_COLOR
                    lblSys.BackColor = ENTERED_INIT_COLOR
                    '>>20180315 大賀 No107 前工程分の入力が完了したら入力完了とする
                    txtData.Enabled = False 'UPD 苗 2018/2/6
                    m_iScore(CInt(txtData.Tag) - 1) = PASS_SCORE_CHECKED
                    'txtData.Focus() 'ADD 苗 2018/2/6
                    'txtData.SelectAll() 'ADD 苗 2018/2/6
                    '<<20180315 大賀 No107 前工程分の入力が完了したら入力完了とする
                    IcTag.szLotNo = txtLotNo.Text
                    CheckCollScore()
                    Exit Sub
                Else
                    ' ラック数が前工程と一致しない場合 または ラックNoが全削除の場合
                    m_iScore(CInt(txtData.Tag) - 1) = PASS_SCORE_WAIT_CHECK
                End If
            End If

            For i = 2 To 6
                If txtData.Name = String.Format("txt{0}0{1}", txtData.Tag.ToString, i) Then
                    lblSys = txtData.Parent.Controls.Find(String.Format("lbl{0}0{1}", txtData.Tag.ToString, i), False)(0)

                    txtData.BackColor = ENTERED_INIT_COLOR
                    lblSys.BackColor = ENTERED_INIT_COLOR
                    txtData.Enabled = False

                    '5列目以下だったらフォーカスを移す
                    If i < 6 Then
                        Dim nextLbl As Label = txtData.Parent.Controls.Find(String.Format("lbl{0}0{1}", txtData.Tag.ToString, i + 1), False)(0)
                        Dim nextTxtData As TextBox = txtData.Parent.Controls.Find(String.Format("txt{0}0{1}", txtData.Tag.ToString, i + 1), False)(0)

                        nextTxtData.Enabled = True
                        nextTxtData.Focus()
                        nextTxtData.SelectAll()
                        '>> 2018/2/22 佐川 ラックNo入力動作を統一
                        nextTxtData.BackColor = FOCUS_INIT_COLOR
                        nextLbl.BackColor = FOCUS_INIT_COLOR
                        '<< 2018/2/22 佐川 ラックNo入力動作を統一
                    End If
                End If
            Next

        End If
    End Sub

    '完了MSラックNo入力処理
    Private Sub afterRackNo_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)

        '頭に付いている'%'を消す
        Static Dim fIsPercentInput As Boolean = False
        If e.KeyChar = CChar("%") OrElse e.KeyChar = CChar("％") Then
            fIsPercentInput = True
            e.Handled = True
            Exit Sub
        End If
        If fIsPercentInput Then
            fIsPercentInput = False
            e.Handled = True
            Exit Sub
        End If

        If e.KeyChar = vbCr Then
            Dim txtData As TextBox = CType(sender, TextBox)
            txtData.Text = txtData.Text.ToUpper 'Add 苗 2018/4/10
            Dim lblSys As Label = txtData.Parent.Controls.Find(String.Format("lbl{0}", txtData.Name.ToString.Substring(3, 4)), False)(0)
            Dim lblMsg As Label = txtData.Parent.Controls.Find(String.Format("lbl{0}00", txtData.Tag.ToString), False)(0)
            Dim rackChkFlg As Boolean = False

            If txtData.Name = String.Format("txt{0}02", txtData.Tag.ToString) Then
                ' LostFocusがラックNo1の場合，空白チェックを行う
                If String.IsNullOrEmpty(txtData.Text) Then
                    txtData.BackColor = ERROR_INIT_COLOR
                    lblSys.BackColor = ERROR_INIT_COLOR
                    '>> 2018/2/22 佐川 ラックNo入力動作を統一
                    'txtData.Enabled = False
                    MsgBox(getMsgStr("MSG00020", (lblMsg.Text).Replace(vbCrLf, "")))
                    txtData.Enabled = True
                    txtData.Focus()
                    txtData.SelectAll()
                    '<< 2018/2/22 佐川 ラックNo入力動作を統一
                    Exit Sub
                End If
            End If

            ' 空白じゃない場合，重複チェックを行う
            If Not String.IsNullOrEmpty(txtData.Text) Then
                If Not after_Rack_No_Check(txtData, lblSys) Then
                    txtData.SelectAll() '2018/2/22 佐川 ラックNo入力動作を統一
                    Exit Sub
                End If
                '>>2018/2/1 佐川 RSB確認結果一覧No64
                '前工程ラックNoと一致している場合はエラー
                If txtData.Text.Equals(txt0302.Text) Or txtData.Text.Equals(txt0303.Text) Or
               txtData.Text.Equals(txt0304.Text) Or txtData.Text.Equals(txt0305.Text) Or txtData.Text.Equals(txt0306.Text) Then
                    txtData.BackColor = ERROR_INIT_COLOR
                    lblSys.BackColor = ERROR_INIT_COLOR
                    '>> 2018/2/22 佐川 ラックNo入力動作を統一
                    'txtData.Enabled = False
                    MsgBox(getMsgStr("MSG10018", txtData.Text))
                    txtData.Enabled = True
                    txtData.Focus()
                    txtData.SelectAll()
                    '<< 2018/2/22 佐川 ラックNo入力動作を統一
                    Exit Sub
                End If
                '<<2018/2/1 佐川 RSB確認結果一覧No64
                '>>20180313 大賀 搬送容器桁数チェックを共通化
                ' ラックNoの桁数チェック
                If Not isCheckCaseLength(txtData, RACK_CASE_NO_LENGTH, lblSys) Then
                    Exit Sub
                End If
                '<<20180313 大賀 搬送容器桁数チェックを共通化
            End If

            For i = 2 To 3
                If txtData.Name = String.Format("txt{0}0{1}", txtData.Tag.ToString, i) Then
                    lblSys = txtData.Parent.Controls.Find(String.Format("lbl{0}0{1}", txtData.Tag.ToString, i), False)(0)

                    txtData.BackColor = ENTERED_INIT_COLOR
                    lblSys.BackColor = ENTERED_INIT_COLOR
                    txtData.Enabled = False

                    '2列目以下だったらフォーカスを移す
                    If i < 3 Then
                        Dim nextLbl As Label = txtData.Parent.Controls.Find(String.Format("lbl{0}0{1}", txtData.Tag.ToString, i + 1), False)(0)
                        Dim nextTxtData As TextBox = txtData.Parent.Controls.Find(String.Format("txt{0}0{1}", txtData.Tag.ToString, i + 1), False)(0)

                        nextTxtData.Enabled = True
                        nextTxtData.Focus()
                        nextTxtData.SelectAll()
                        nextTxtData.BackColor = Color.Cyan
                        nextLbl.BackColor = Color.Cyan
                    End If
                End If
            Next

        End If

    End Sub

    '完了MSラックNoチェック
    Protected Function after_Rack_No_Check(ByVal txtData As TextBox, ByVal lblSys As Label) As Boolean
        'ラックNoが削除ラックNoの場合、重複チェックを行わない。
        If DELETE_RACK_NO.Equals(txtData.Text) Then
            Return True
        End If
        Dim lblRack As Label = txtData.Parent.Controls.Find(String.Format("lbl{0}00", txtData.Tag.ToString), False)(0)
        ' 重複チェックを行う
        Dim txtDataCheck As TextBox = txtData.Parent.Controls.Find(String.Format("txt{0}02", txtData.Tag.ToString), False)(0)
        ' LostFocusしたラックNo以外と比較
        If Not txtData.Name.Equals(txtDataCheck.Name) Then
            ' 入力されたラックNoが同じ値の場合
            If txtData.Text.Equals(txtDataCheck.Text) Then
                txtData.BackColor = ERROR_INIT_COLOR
                lblSys.BackColor = ERROR_INIT_COLOR
                '>> 2018/2/22 佐川 ラックNo入力動作を統一
                'txtData.Enabled = False
                MsgBox(getMsgStr("MSG00064", (lblRack.Text).Replace(vbCrLf, "")))
                txtData.Enabled = True
                txtData.Focus()
                txtData.SelectAll()
                '<< 2018/2/22 佐川 ラックNo入力動作を統一
                m_iScore(CInt(txtData.Tag) - 1) = PASS_SCORE_WAIT_CHECK
                Return False
            End If
        End If
        Return True
    End Function

    '画面項目の表示切替
    Public Overrides Sub ConfScreenItem()
        If txtLotNo.TextLength > 0 Then
            If IcTag.Status = TagProcessStatus.Ready Then
                '着工待ち
                btnBarCode2.Enabled = True
                btnBarCode3.Enabled = False

                '完了MSラックNo
                txt0402.BackColor = NORMAL_INIT_COLOR
                lbl0402.BackColor = NORMAL_INIT_COLOR
                txt0403.BackColor = NORMAL_INIT_COLOR
                lbl0403.BackColor = NORMAL_INIT_COLOR

                '廃棄フレーム数
                lbl0502.Enabled = False
                lbl0502.BackColor = NORMAL_INIT_COLOR

            ElseIf IcTag.Status = TagProcessStatus.Processing Or IcTag.Status = TagProcessStatus.ManufComplete Then
                btnBarCode2.Enabled = False
                btnBarCode3.Enabled = True
                lbl0502.Enabled = True

                '受入ラックNo
                lbl0302.BackColor = NORMAL_INIT_COLOR
                txt0302.BackColor = NORMAL_INIT_COLOR
                lbl0303.BackColor = NORMAL_INIT_COLOR
                txt0303.BackColor = NORMAL_INIT_COLOR
                lbl0304.BackColor = NORMAL_INIT_COLOR
                txt0304.BackColor = NORMAL_INIT_COLOR
                lbl0305.BackColor = NORMAL_INIT_COLOR
                txt0305.BackColor = NORMAL_INIT_COLOR
                lbl0306.BackColor = NORMAL_INIT_COLOR
                txt0306.BackColor = NORMAL_INIT_COLOR

                '完了MSラックNo
                txt0402.BackColor = BARCODE_INIT_COLOR
                lbl0402.BackColor = BARCODE_INIT_COLOR
                txt0403.BackColor = BARCODE_INIT_COLOR
                lbl0403.BackColor = BARCODE_INIT_COLOR

                '廃棄フレーム数
                lbl0502.Enabled = True
                lbl0502.BackColor = TENKEY_INIT_COLOR

            Else
                '不正
                MsgBox(getMsgStr("MSG00025"))

            End If

        End If

    End Sub

    '計上完成正常時の画面初期化
    Protected Overrides Sub initializForm()
        MyBase.initializForm()
        InputDataClear()
        lbl0502.Text = String.Empty
    End Sub

    '受入ラックNoタブキー対応
    Private Sub rackNoMD_PreviewKeyDown(ByVal sender As Object, ByVal e As PreviewKeyDownEventArgs) _
        Handles txt0302.PreviewKeyDown, txt0303.PreviewKeyDown, txt0304.PreviewKeyDown, txt0305.PreviewKeyDown, txt0306.PreviewKeyDown
        'タブキーが押下された場合は、改行コードと見なし処理を行う
        If e.KeyCode = Keys.Tab Then
            e.IsInputKey = True
            txtRackNoMD_KeyPress(sender, New KeyPressEventArgs(vbCr))
        End If
    End Sub

    '受入ラックNoタブキー対応
    Private Sub afterRackNo_PreviewKeyDown(ByVal sender As Object, ByVal e As PreviewKeyDownEventArgs) Handles txt0402.PreviewKeyDown, txt0403.PreviewKeyDown
        'タブキーが押下された場合は、改行コードと見なし処理を行う
        If e.KeyCode = Keys.Tab Then
            e.IsInputKey = True
            afterRackNo_KeyPress(sender, New KeyPressEventArgs(vbCr))
        End If
    End Sub

    '>>2018/1/31 佐川 キャリア交換対応
    'IcTag保存内容設定
    Protected Overrides Sub icTagDataSet()
        '製造完成、計上完成時は画面入力値の値を設定する。
        If execMode.Equals(COMPLETE) Or execMode.Equals(TOTAL) Then
            IcTag.container1 = txt0402.Text
            IcTag.container2 = txt0403.Text
            IcTag.container3 = String.Empty
            IcTag.container4 = String.Empty
            IcTag.container5 = String.Empty
        Else
            '初期値をそのまま保存するため、変更しない。
        End If
    End Sub
    '<<2018/1/31 佐川 キャリア交換対応

    '>> 2018/2/22 佐川 ラックNo入力動作を統一
    ' ラックNo用バーコードクリック
    Protected Sub btnAfterRackNo_Click(ByVal sender As Object, ByVal e As EventArgs)
        Dim btn As Button = CType(sender, Button)

        ' 画面の初期化
        txt0402.Text = String.Empty
        txt0403.Text = String.Empty
        txt0403.BackColor = TENKEY_INIT_COLOR
        lbl0403.BackColor = TENKEY_INIT_COLOR

        ' 入力フォーカスの設定
        Dim txtData As TextBox = btn.Parent.Controls.Find(String.Format("txt{0}02", btn.Tag.ToString), False)(0)
        Dim lblData As Label = txtData.Parent.Controls.Find(String.Format("lbl{0}02", txtData.Tag.ToString), False)(0)
        txtData.Enabled = True
        txtData.Focus()
        txtData.SelectAll()
        txtData.BackColor = Color.Cyan
        lblData.BackColor = Color.Cyan
    End Sub
    '<< 2018/2/22 佐川 ラックNo入力動作を統一

    ' >> 20180307 大賀 作業者入力確定時に次の入力にフォーカスを移動する
    ''' <summary>
    ''' 作業者入力後のフォーカスを各画面で設定する
    ''' 各画面でオーバーライドされない場合はTabIndex順に移動する
    ''' </summary>
    ''' <param name="inputType">作業者入力タイプ</param>
    ''' <param name="nowControl">対象コントロール</param>
    Protected Overrides Sub setNextFocus(ByVal inputType As OPERATER_INPUT_TYPE, ByVal nowControl As Control)
        If m_ProcessStatus <> ProcessStatus.Ready Then  ' ロット未入力の場合は処理しない
            If IcTag.Status = TagProcessStatus.Ready Then   ' 未着工
                If inputType = OPERATER_INPUT_TYPE.START_OPE Then
                    tabBase.SelectedTab = TabPageSp ' タブの移動
                    If String.IsNullOrEmpty(txt0302.Text) Then  ' 未入力の場合に入力可能にする
                        btnBarCode2.PerformClick()  ' バーコード入力ボタンを押す
                        Exit Sub
                    End If
                End If
            ElseIf IcTag.Status = TagProcessStatus.Processing Then  ' 着工中
                If inputType = OPERATER_INPUT_TYPE.END_OPE Then
                    tabBase.SelectedTab = TabPageSp ' タブの移動
                    If String.IsNullOrEmpty(txt0402.Text) Then  ' 未入力の場合に入力可能にする
                        btnBarCode3.PerformClick()  ' バーコード入力ボタンを押す
                        Exit Sub
                    End If
                End If
            ElseIf IcTag.Status = TagProcessStatus.ManufComplete Then ' 製造完成

            End If
        End If
        ' 各画面個別のフォーカスに移動しない場合は次のTabIndexに移動
        SelectNextControl(nowControl, True, True, True, True)
    End Sub
    ' << 20180307 大賀 作業者入力確定時に次の入力にフォーカスを移動する

    ' >> 20180710 佐川 ラックNo途入力改善
    Public Overrides Sub rackInputFocus(ByVal sender As Object, ByVal e As System.EventArgs)
        '未着工のみ選択可能にする
        If IcTag.Status = TagProcessStatus.Ready Then
            MyBase.rackInputFocus(sender, e)
        End If
    End Sub

    Public Sub afterRackInputFocus(ByVal sender As Object, ByVal e As System.EventArgs)
        '着工中のみ選択可能にする
        If IcTag.Status = TagProcessStatus.Processing Then
            MyBase.rackInputFocus(sender, e)
        End If
    End Sub
    ' << 20180710 佐川 ラックNo途入力改善

    '--自動着完工用実装分--BEGIN　2019/11/29
    Protected Overrides Sub setBeforeRackNo(Optional inputRackNo As String = "")
        If IsNothing(IcTag.szLotNo) = False Then
            If IcTag.container1 <> "" Then
                txt0302.Text = IcTag.container1
                If AutoManualMode = 1 Then txtRackNoMD_KeyPress(txt0302, New System.Windows.Forms.KeyPressEventArgs(vbCr))
            End If
            If IcTag.container2 <> "" Then
                txt0303.Text = IcTag.container2
                If AutoManualMode = 1 Then txtRackNoMD_KeyPress(txt0303, New System.Windows.Forms.KeyPressEventArgs(vbCr))

            End If
            If IcTag.container3 <> "" Then
                txt0304.Text = IcTag.container3
                If AutoManualMode = 1 Then txtRackNoMD_KeyPress(txt0304, New System.Windows.Forms.KeyPressEventArgs(vbCr))

            End If
            If IcTag.container4 <> "" Then
                txt0305.Text = IcTag.container4
                If AutoManualMode = 1 Then txtRackNoMD_KeyPress(txt0305, New System.Windows.Forms.KeyPressEventArgs(vbCr))

            End If
            If IcTag.container5 <> "" Then
                txt0306.Text = IcTag.container5
                If AutoManualMode = 1 Then txtRackNoMD_KeyPress(txt0306, New System.Windows.Forms.KeyPressEventArgs(vbCr))

            End If
            m_iScore(txt0302.Tag - 1) = PASS_SCORE_CHECKED
        End If
    End Sub

    Protected Overrides Function setAfterRackNo(receiveData As receiveCommandData) As Boolean
        If receiveData.UrackNoList.Count = 0 Then
            Return False
        End If
        '完工MS料盒设置
        If IsNothing(receiveData.UrackNoList(0)) = False Then
            txt0402.Text = receiveData.UrackNoList(0)
        End If
        If IsNothing(receiveData.UrackNoList(1)) = False Then
            txt0403.Text = receiveData.UrackNoList(1)
        End If
        Return True
    End Function
    ''' <summary>
    ''' 设置画面控件是否可用
    ''' </summary>
    ''' <param name="mode">True:自动状态，False：手动状态</param>
    Protected Overrides Sub setAutoScreen(mode As Boolean)

        Dim setColor As Color = NORMAL_INIT_COLOR
        Dim setEnabled As Boolean = Not (mode)

        '完工后，是否清空画面，清空后ictag也被清空（手动时为true,自动时为false)
        'initializForm_FLG = setEnabled

        If mode = True Then
            setColor = NORMAL_INIT_COLOR
        Else
            setColor = BUTTON_INIT_COLOR
        End If
        '受入MSラック
        txt0302.Enabled = setEnabled
        txt0303.Enabled = setEnabled
        txt0303.Enabled = setEnabled
        txt0304.Enabled = setEnabled
        txt0305.Enabled = setEnabled
        txt0306.Enabled = setEnabled
        '完工MSラック
        txt0402.Enabled = setEnabled
        txt0403.Enabled = setEnabled

        '背景色設定
        '受入MSラック
        txt0302.BackColor = setColor
        txt0303.BackColor = setColor
        txt0303.BackColor = setColor
        txt0304.BackColor = setColor
        txt0305.BackColor = setColor
        txt0306.BackColor = setColor

        lbl0302.BackColor = setColor
        lbl0303.BackColor = setColor
        lbl0303.BackColor = setColor
        lbl0304.BackColor = setColor
        lbl0305.BackColor = setColor
        lbl0306.BackColor = setColor

        '完工MSラック
        txt0402.BackColor = setColor
        txt0403.BackColor = setColor

        lbl0402.BackColor = setColor
        lbl0403.BackColor = setColor
        btnBarCode2.Enabled = setEnabled
    End Sub

    '--自動着完工用実装分--END　2019/11/29
    Protected Overrides Function chkSumSHOTValue() As Boolean
        Dim sumSHOTNum As Integer = 0
        Dim LSPECVALUE As Integer = 0
        Dim SPECVALUE As Integer = 0

        Dim objDieClean As New clsDieClean
        Dim chk As Boolean = True

        '規格値を取得
        SPECVALUE = objDieClean.selSpecValue(lblEquipID.Text)

        '累計SHOT数を取得
        objDieClean.selDieCleanSPEC(lblEquipID.Text, sumSHOTNum, LSPECVALUE, SPECVALUE)

        Dim midValue = (LSPECVALUE + SPECVALUE) / 2
        NUMFLAG = 0

        If SPECVALUE > 0 And sumSHOTNum > 0 And LSPECVALUE > 0 And midValue > 0 Then

            If SHOTNum + sumSHOTNum >= LSPECVALUE And SHOTNum + sumSHOTNum <= midValue Then
                setCheckInfo("SHOT数已经大于" & LSPECVALUE)
                NUMFLAG = 1
            End If
            If SHOTNum + sumSHOTNum >= midValue And SHOTNum + sumSHOTNum < SPECVALUE Then
                setCheckInfo("SHOT数已经大于" & midValue)
                NUMFLAG = 2
            End If

            If SHOTNum + sumSHOTNum > SPECVALUE Then
                setCheckInfo(getMsgStr("MSG10054")）
                chk = False
            End If

        End If

        Return chk

    End Function

    ''' <summary>
    ''' 材料区分が本工程の区分かどうか判断
    ''' </summary>
    ''' <param name="materialType">材料区分</param>
    ''' <returns>判断結果</returns>
    Protected Overrides Function chkMaterialType(materialType As String) As Boolean
        Dim rtn As Boolean = False

        'If EXEC_PG_TAG_RESIN.Contains(materialType.ToUpper) Then
        '    rtn = True
        'End If
        If Trim(materialType) = "7" Then
            rtn = True
        End If
        Return rtn
    End Function

    ''' <summary>
    ''' atlasの材料補充を呼び出す
    ''' </summary>
    ''' <param name="materialType">材料区分</param>
    ''' <param name="mat">材料名</param>
    Protected Overrides Sub callAtlasExec(materialType As String, mat As String)

        Dim strMaterialType As String = ""

        If Trim(materialType) = "7" Then
            strMaterialType = EXEC_PG_TAG_RESIN
        End If
        If strMaterialType = "" Then Exit Sub

        '外部EXEを呼び出す
        Dim strRetStatus As String = Execute_Command(IIf(AProcCD() = "", lblProcessCD.Text, AProcCD), strMaterialType, IcTag.szLotNo, g_EQUIP_NO, mat, UserNo) 'UPD 苗 2018/1/24,1/26ロットNO.装置No.を設定
        '戻り値による処理は未定のため、現在は未実装
        If strRetStatus = "0" Then
            'B-Siteチェック
            bsiteRtn = checkMachineInf()
        Else
            MsgBox(getMsgStr("MSG10009", strRetStatus))
        End If
    End Sub

    Private Sub ResinTimer_Tick(sender As Object, e As EventArgs) Handles ResinTimer.Tick
        ' 使用期限のタイマー処理
        ResinTimer.Enabled = False
        If Not IcTag.Status <> TagProcessStatus.Ready Then
            ' 着工中でない場合，タイマーをストップする
            Exit Sub
        End If

        ' ペースト1行目
        If Not String.IsNullOrEmpty(lbl0106.Text) Then
            If Not checkExpirationDate(lbl0106, 0) Then
                Exit Sub
            End If
        End If

        ResinTimer.Enabled = True
    End Sub
    ' 使用期限のチェックを行う
    Private Function checkExpirationDate(labelDate As Label, index As Integer) As Boolean

        '現在の日付を取得する
        Dim dtNow As DateTime = m_cData.GetServerTime()
        Dim dt As DateTime
        If DateTime.TryParse(labelDate.Text, dt) Then
            dt.AddMinutes(-20) 'ADD MIAO　20191227 UPD 材料期限-20分をオーバーしたらエラーメッセージを表示する

            If DateTime.Compare(dt, dtNow) < 0 OrElse DateTime.Compare(dt, dtNow) = 0 Then
                MsgBox(getMsgStr("MSG00049", labelDate.Text))
                checkColor(labelDate, False, labelDate.Name)
                m_iScore(index) = PASS_SCORE_WAIT_CHECK
                Return False
            Else
                '製造条件一致
                m_iScore(index) = PASS_SCORE_CHECKED
            End If
        Else
            MsgBox(getMsgStr("MSG00048", lbl0100.Text))
            checkColor(labelDate, False, labelDate.Name)
            m_iScore(index) = PASS_SCORE_WAIT_CHECK
            Return False
        End If
        Return True
    End Function

    Protected Overrides Sub doRandCheck(dtmst As DataTable, dtRecords As DataTable)
        Dim objRCHistory As New clsRandCheckHistory
        Dim objRecords As New clsRandCheckRecords
        Dim frameCount As Integer = 0
        '抜取検査履歴追加
        ''MSTの抜取検査数がある場合：履歴追加
        If dtmst.Rows(0)("CheckNum") <> 0 Then
            intDP_CNT = CInt(m_cData.getDTCount(IcTag.szLotNo))
            If intDP_CNT <> 0 Then
                frameCount = Math.Ceiling(dtmst.Rows(0)("CheckNum") / intDP_CNT)
            End If
            objRCHistory.insertData(IcTag.szLotNo, IcTag.szProcsCD, txt0302.Text, lblEquipID.Text, txtOptNoStt.Text, IcTag.iInput, dtmst.Rows(0)("CheckNum"), frameCount, dtmst.Rows(0)("NGNum"), 0, "", RC_TYPEX)
            setRandCheckInfo("LOT：" & IcTag.szLotNo)

        End If
        ''MSTの抜取検査数がない場合：AQLテーブルでAQLの抜取検査数を検索し、履歴追加
        If IsDBNull(dtmst.Rows(0)("CheckNum")) OrElse dtmst.Rows(0)("CheckNum") = 0 Then
            Dim objAQL As New clsSampleNumAQL
            Dim rdChecknum As Integer = 0
            Dim NGNum_DEF As Integer
            Dim dt As DataTable
            Dim tmpSuminvnum As Integer = 0

            If dtRecords.Rows.Count > 0 Then tmpSuminvnum = dtRecords.Rows(0)("SUMINVNUM")

            dt = objAQL.selectAQLValue(tmpSuminvnum + IcTag.iInput, dtmst.Rows(0)("CHECKFREQ"))
            If dt.Rows.Count > 0 Then
                rdChecknum = dt.Rows(0)("CheckNum")
                NGNum_DEF = dt.Rows(0)("ngNum")
                intDP_CNT = CInt(m_cData.getDTCount(IcTag.szLotNo))
                If intDP_CNT <> 0 Then
                    frameCount = Math.Ceiling(dt.Rows(0)("CheckNum") / intDP_CNT)
                End If
                objRCHistory.insertData(IcTag.szLotNo, IcTag.szProcsCD, txt0302.Text, lblEquipID.Text, txtOptNoStt.Text, IcTag.iInput, rdChecknum, frameCount, NGNum_DEF, 0, "", RC_TYPE)
                setRandCheckInfo("LOT：" & IcTag.szLotNo)

            End If
        End If
        '記録削除
        objRecords.deleteRecords(lblEquipID.Text)


    End Sub
    Protected Overrides Sub dontRandCheck(dtRecords As DataTable, ProdName As String, PKG As String, countNum As Integer)
        Dim objRecords As New clsRandCheckRecords

        '記録がある場合修正、ない場合の追加
        If dtRecords.Rows.Count = 0 Then
            objRecords.insertRecords(lblEquipID.Text, ProdName, PKG, countNum, IcTag.iInput)
        Else
            objRecords.updateRecords(lblEquipID.Text, dtRecords.Rows(0)("CountNum") + countNum, dtRecords.Rows(0)("SUMINVNUM") + IcTag.iInput)
        End If


    End Sub
    Protected Overrides Sub updateRCRackID()
        Dim objRCHistory As New clsRandCheckHistory
        objRCHistory.updateRackNo(IcTag.szLotNo, lblProcessCD.Text, txt0302.Text, txt0402.Text)
    End Sub
    Overrides Function checkBsiteMachineInf() As Boolean
        Return checkMachineInf()
    End Function
    Overrides Function setXinFlg() As Integer
        Return 1
    End Function
    Overrides Sub setICtagByFrameInfo()
        Dim dt As DataTable
        If m_szFrameid_comp = 1 And IcTag.iFrameIDUse = 1 Then
            dt = m_cLotDefect.GetFrameInfo(PROC_CD_WBA, IcTag.szLotNo)
            If IsNothing(dt) = False AndAlso dt.Rows.Count > 0 AndAlso dt.Rows(0)("totalPkgCnt").ToString <> "0" Then
                IcTag.iInput = CInt(dt.Rows(0)("totalOkCnt").ToString)  '投入数
                IcTag.iFinish = CInt(dt.Rows(0)("totalOkCnt").ToString)  '完成数

                'IcTag. = dt.Rows(0)("totalNGCnt").ToString  '不良数
                IcTag.iFrame = CInt(dt.Rows(0)("frameCnt").ToString)       'フレーム数
                IcTag.iCross = CInt(dt.Rows(0)("totalCrossCnt").ToString)
                IcTag.iCrossFrm = CInt(dt.Rows(0)("crossPcbCnt").ToString)
                IcTag.emptyChipNum = CInt(dt.Rows(0)("totalEmptyCnt").ToString) '空チップ数 
                inputCrossPcbCnt = IcTag.iCrossFrm
            End If
        End If
    End Sub
    Public Overrides Sub updateRackInfo()
        Dim rackNo As New ArrayList
        Dim dbLot As New clsDbLotDefect
        If txt0402.Text <> "" Then
            rackNo.Add(txt0402.Text)
        End If
        If txt0403.Text <> "" Then
            rackNo.Add(txt0403.Text)
        End If

        dbLot.DelInsRackInfo(IcTag.szLotNo, rackNo)
    End Sub

    ''' <summary>
    ''' 设置LC的パッケージ名/製品外形 ： package的前6位 + “-” + 树脂
    ''' </summary>
    ''' <returns></returns>
    Overrides Function getLCPackage() As String 'add miaojf 2020/8/12 ver.60
        Dim resin As String = lbl0102.Text

        If resin = "" Then
            '条件テーブル取得
            resin = m_cData.GetResin(txtLotNo.Text)
        End If

        Return lblShape.Text.Substring(0, 6) & "-" & resin
    End Function

End Class